<!DOCTYPE html>
<html lang="en">
<head>
    <title>Banner图跳转链接内容编辑管理</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layui/style/admin.css" media="all">
</head>
<body>
<div>
    <div class="layui-fluid">
        <div class="layui-card">
            <form id="bannerContextForm">
                <textarea id="banner_url_context" name="context" class="layui-textarea"></textarea>
            </form>
            <button class="layui-btn layui-btn-normal layui-btn-lg" id="saveContext">保存</button>
        </div>
    </div>
</div>
</body>
<script src="layui/layui.js"></script>
<script src="jquery/jquery.min.js"></script>
<script src="kindeditor/kindeditor-all.js"></script>
<script src="kindeditor/lang/zh-CN.js"></script>
<script>
    KindEditor.ready(function (K) {
        window.editor = K.create('#banner_url_context', {
            items: ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage',
                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                'anchor', 'link', 'unlink', '|', 'about'],
            allowFileManager: true,
            filePostName: 'file',//跟服务端参数对应
            uploadJson: "/kindeditor/fileUpload",
            fileManagerJson: "/kindeditor/fileManager",//指定浏览远程图片的服务器端程序
            minHeight: 500,
            afterUpload: function (url) {
                alert("上传成功");
            }
        });
    });

    $('#saveContext').click(function (e) {
        // var formData = $('form[id="bannerContextForm"]').serialize();
        var text = editor.text();
            // 通过kindEditor数据到textarea
            window.editor.sync();
            // 提交表单
            $("#bannerContextForm").submit();
    })
</script>
</html>